import 'package:base_pay/base_pay.dart';
import 'package:base_pay/entity/product/IProductDetails.dart';
import 'package:base_pay/entity/purchase/IPurchaseDetails.dart';
import 'package:plugin_platform_interface/plugin_platform_interface.dart';

import 'base_pay_method_channel.dart';

abstract class BasePayPlatform extends PlatformInterface {
  /// Constructs a BasePayPlatform.
  BasePayPlatform() : super(token: _token);

  static final Object _token = Object();

  static BasePayPlatform _instance = MethodChannelBasePay();

  /// The default instance of [BasePayPlatform] to use.
  ///
  /// Defaults to [MethodChannelBasePay].
  static BasePayPlatform get instance => _instance;

  /// Platform-specific implementations should set this with their own
  /// platform-specific class that extends [BasePayPlatform] when
  /// they register themselves.
  static set instance(BasePayPlatform instance) {
    PlatformInterface.verifyToken(instance, _token);
    _instance = instance;
  }

  Future<String?> getPlatformVersion() {
    throw UnimplementedError('platformVersion() has not been implemented.');
  }

  Future<bool> isAvailable() {
    throw UnimplementedError('isAvailable() has not been implemented.');
  }

  Future<List<IProductDetails>> queryProductDetails(
    Set<String> identifiers, {
    bool? priorityTrial,
    bool? getAll,
  }) {
    throw UnimplementedError('queryProductDetails() has not been implemented.');
  }

  void listenToPurchaseUpdated(purchaseDetailsList) {
    throw UnimplementedError('listenToPurchaseUpdated() has not been implemented.');
  }

  Future<bool> buyNonConsumable(IProductDetails iProductDetails, {String? token}) async {
    throw UnimplementedError('buyNonConsumable() has not been implemented.');
  }

  restorePurchases({String? token}) {
    throw UnimplementedError('restorePurchases() has not been implemented.');
  }

  queryHistory({String? token}) {
    throw UnimplementedError('queryHistory() has not been implemented.');
  }

  completePurchase(IPurchaseDetails iPurchaseDetails) {
    throw UnimplementedError('completePurchase() has not been implemented.');
  }

  verifyTheResultsAgain(VerifyAgainParam param, {int reTryNum = 3}) {
    throw UnimplementedError('VerifyAgainParam() has not been implemented.');
  }

  verifyTheResultsAgain2(VerifyAgainParam param, {required int reTryNum}) {
    throw UnimplementedError('VerifyAgainParam2() has not been implemented.');
  }

  Future<String?> getiOSReceipt() {
    throw UnimplementedError('getiOSReceipt() has not been implemented.');
  }
}
